import { request } from "@/utils/request";

//  获取用户列表
export function reqUserList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/list",
    method: "get",
    params
  });
}

// 用户列表-删除0分用户
export function reqDelZeroCoinUser() {
  return request({
    url: "/roomManage/room/user/delZero",
    method: "post"
  });
}

// 用户列表-用户详情
export function reqUserInfo(UserId: number) {
  return request<MemberInfoMo>({
    url: "/roomManage/room/user/info",
    method: "get",
    params: {
      UserId
    }
  });
}

// 私信
export function reqUserChatSendMsg(data: Record<string, any>) {
  return request({
    url: "/roomManage/chat/send_private_msg",
    method: "post",
    data
  });
}

// 用户列表-分数操作
export function reqUpDownPoints(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/upDownPoints",
    method: "post",
    data
  });
}

// 用户列表-修改密码
export function reqUserResetPassword(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/updatePassword",
    method: "post",
    data
  });
}

// 用户列表-设置为代理
export function reqUserBecomeAgent(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/becomeAgent",
    method: "post",
    data
  });
}

// 用户列表-禁言
export function reqUserBan(data: {
  UserId: number;
  // 1正常 0禁用 2禁言 3禁止加入
  Status: number;
}) {
  return request({
    url: "/roomManage/room/user/ban",
    method: "post",
    data
  });
}

// 用户列表-删除用户
export function reqUserDel(UserId: number) {
  return request({
    url: "/roomManage/room/user/del",
    method: "post",
    data: {
      UserId
    }
  });
}

// 重置下分密码
export function reqUserUpdateWithdrawPassword(UserId: number) {
  return request({
    url: "/roomManage/room/user/updateWithdrawPassword",
    method: "post",
    data: {
      UserId
    }
  });
}

// 代注
export function reqUserBehalf(data: {
  UserId: number;
  /** 是否代注 0否 1是 */
  IsBehalf: number;
}) {
  return request({
    url: "/roomManage/room/user/behalf",
    method: "post",
    data
  });
}

// 关注用户
export function reqUserFollow(data: {
  UserId: number;
  /** 0未关注 1关注 */
  IsFollow: number;
}) {
  return request({
    url: "/roomManage/room/user/follow",
    method: "post",
    data
  });
}

// 修改备注
export function reqUserNoteEdit(data: { UserId: number; Note: string }) {
  return request({
    url: "/roomManage/room/user/noteEdit",
    method: "post",
    data
  });
}

// 在线用户
export function reqUserOnlineList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/online/list",
    method: "get",
    params
  });
}

// 代理列表
export function reqAgentList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/agent/list",
    method: "get",
    params
  });
}

// 代理分组列表
export function reqAgentGroupList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/agentGroup/list",
    method: "get",
    params
  });
}

// 下线列表
export function reqAgentUserList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/agentUserList",
    method: "get",
    params
  });
}

// 添加下线
export function reqAddAgentUser(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/addAgentUser",
    method: "post",
    data
  });
}

// 删除下级代理
export function reqDelAgent(UserId: number) {
  return request({
    url: "/roomManage/room/user/delAgent",
    method: "post",
    data: {
      UserId
    }
  });
}

// 删除下线
export function reqDelAgentUser(UserId: number) {
  return request({
    url: "/roomManage/room/user/delAgentUser",
    method: "post",
    data: {
      UserId
    }
  });
}

// 抽佣比例展示
export function reqUserCommissionRate(params: Record<string, any>) {
  return request<CommissionRateMo[]>({
    url: "/roomManage/room/user/commissionRate/show",
    method: "get",
    params
  });
}

// 抽佣比例
export function reqUserCommissionRateEdit(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/commissionRate",
    method: "post",
    data
  });
}
// 代理分组-添加
export function reqAgentGroupAdd(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/agentGroup/add",
    method: "post",
    data
  });
}

// 代理分组-编辑
export function reqAgentGroupEdit(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/agentGroup/edit",
    method: "post",
    data
  });
}

// 文件上传
export function reqUploadImg(data: FormData, cb?: Function) {
  return request<{ ImgPath: string }>({
    url: "/roomManage/uploads/img",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data,
    onUploadProgress: progressEvent => {
      cb && cb(progressEvent);
    }
  });
}

// 发红包
export function reqSendRedPacket(data: Record<string, any>) {
  return request<{ ImgPath: string }>({
    url: "/roomManage/hongbao/send",
    method: "post",
    data
  });
}

// 机器人列表
export function reqRobotList(params: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/robot/list",
    method: "get",
    params
  });
}

// 添加机器人
export function reqRobotAdd(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/robot/add",
    method: "post",
    data
  });
}

// 修改机器人
export function reqRobotEdit(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/robot/edit",
    method: "post",
    data
  });
}

// 修改机器人状态
export function reqRobotStatus(Id: number, Status: number) {
  return request({
    url: "/roomManage/room/user/robot/editStatus",
    method: "post",
    data: {
      Id,
      Status
    }
  });
}

// 机器人-全部状态变更(开启/关闭)
export function reqRobotAllStatus(Status: number) {
  return request({
    url: "/roomManage/room/user/robot/editStatus",
    method: "post",
    data: {
      Status
    }
  });
}

// 删除机器人
export function reqRobotDel(Id: number) {
  return request({
    url: "/roomManage/room/user/robot/del",
    method: "post",
    data: { Id }
  });
}

// 系统头像
export function reqUserSystemImage() {
  return request({
    url: "/roomManage/room/user/sysImage",
    method: "get"
  });
}

// 用户反水设置展示
export function reqUserBackWaterSetting(UserId: number) {
  return request<BackWaterSettingMo>({
    url: "/roomManage/room/user/backWater/setting/show",
    method: "get",
    params: {
      UserId
    }
  });
}

// 用户反水设置-批量修改
export function reqUserBackWaterBatch(data: Record<string, any>) {
  return request({
    url: "/roomManage/room/user/backWater/setting/batch",
    method: "post",
    data
  });
}

// 子账号
export function reqUserSubAccountsList(params: Record<string, any>) {
  return request({
    url: "/roomManage/user/subAccounts/list",
    method: "get",
    params
  });
}
// 权限列表
export function reqUserSubAccountsPerms() {
  return request<PermsMo[]>({
    url: "/roomManage/user/accounts/perms",
    method: "get"
  });
}

// 子账号-添加
export function reqUserSubAccountsAdd(data: Record<string, any>) {
  return request({
    url: "/roomManage/user/subAccounts/add",
    method: "post",
    data
  });
}

// 子账号-修改
export function reqUserSubAccountsEdit(data: Record<string, any>) {
  return request({
    url: "/roomManage/user/subAccounts/edit",
    method: "post",
    data
  });
}

// 子账号-删除
export function reqUserSubAccountsDel(data: Record<string, any>) {
  return request({
    url: "/roomManage/user/subAccounts/del",
    method: "post",
    data
  });
}

// 用户名查询
export function reqUserQuery(params: Record<string, any>) {
  return request<
    {
      UserId: number;
      Name: string;
    }[]
  >({
    url: "/roomManage/room/user/query",
    method: "get",
    params
  });
}
